package com.huilian.iotbox.admin.wap.controller;

import com.huilian.iotbox.admin.wap.service.CommodityInfoCommonService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.po.CommodityInfoCommon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 谢洛涛
 * @date 2023/9/7 20:19
 */
@RestController
@RequestMapping("/api/commodityInfoCommon")
public class CommodityInfoCommonController extends UserInfoController {
    @Autowired
    private CommodityInfoCommonService commodityInfoCommonService;
    /**这个方法会查询出公有和私有的商品，如果要查询公用的请调用另外方法*/
    @PostMapping("/findCommodityInfoCommon")
    public ServerResponse findCommodityInfCommon(@RequestBody CommodityInfoCommon commodityInfoCommon){
        return ServerResponse.createBySuccess(commodityInfoCommonService.findCommodityInfCommon(commodityInfoCommon));
    }

    /**
     * 根据扫条码查询商品
     * */
    @PostMapping("/findOneCommodityInfoCommon")
    public ServerResponse findOneCommodityInfoCommon(@RequestBody CommodityInfoCommon commodityInfoCommon){
        return commodityInfoCommonService.findOneCommodityInfoCommon(commodityInfoCommon);
    }
}
